<?php

class PagesController extends Controller
{
	public function actionIndex()
	{
		$criteria=new CDbCriteria();
		$criteria->condition='status=:status and id=:id';
		$criteria->params=array(':status'=>Pages::STATUS_PUBLIC, ':id'=>Yii::app()->request->getQuery('id'));

		$content=Pages::model()->find($criteria);

		if($content===null){
			throw new CHttpException(404,'The requested page does not exist.');
		}

		$this->render('index',array('content'=>$content));
	}

}